home *** CD-ROM | disk | FTP | other *** search
- /*
- | file name -- GRtextarray.h
- |===================================================================
- |
- | copyright (c) 1988, V.I. corporation
- |
- | GRtextarray - Include for using GRtextarray
- |
- | alan c morse 9 Nov 88
- |
- |===================================================================
- */
- #ifndef _GRTEXTARRAY_H_
- #define _GRTEXTARRAY_H_
-
- /* Data structures */
- typedef struct CHAR_CELL
- { char color, c; } CHAR_CELL;
-
- typedef struct CHAR_POSITION
- { short row, col; } CHAR_POSITION;
-
- typedef struct CHAR_RECT
- { CHAR_POSITION ul, lr; } CHAR_RECT;
-
- /* -- macros for processing a CHAR_RECT --- */
- #define CRWIDTH(a) ((a)->lr.col - (a)->ul.col + 1)
- #define CRHEIGHT(a) ((a)->lr.row - (a)->ul.row + 1)
- #define CRASSIGN(a, ulrow, ulcol, lrrow, lrcol ) \
- ((a)->ul.row = ulrow, (a)->ul.col = ulcol, \
- (a)->lr.row = lrrow, (a)->lr.col = lrcol )
- #define CRCOPY(dst,src) \
- ((dst)->ul.row = (src)->ul.row, (dst)->ul.col = (src)->ul.col, \
- (dst)->lr.row = (src)->lr.row, (dst)->lr.col = (src)->lr.col )
-
- #define TA_NUM_COLORS 8
-
- /* Define directions for sliding text */
- #define SLIDE_RIGHT 1
- #define SLIDE_UP 2
- #define SLIDE_LEFT 3
- #define SLIDE_DOWN 4
-
- /* -- macros for packing and unpacking character color attributes --- */
- #define PACK_COLOR( fore, back ) (((fore & 0x7)<<4)|(back & 0x7))
- #define UNPACK_COLOR( color, fore, back ) \
- ( fore = (((unsigned int)color)>>4) & 0x7, back = color & 0x7 )
-
- /* prepacked text colors */
- #define A_NORMAL 0x10
- #define A_INVERSE 0x01
-
- /* Macro to write only one character */
- #define GRtaWriteChar( ta, row, col, ncols, c, color ) \
- { \
- int n = ncols; \
- char s[2]; \
- s[0] = c; \
- s[1] = '\0'; \
- while( n-- > 0 ) \
- (VOID)GRtaWrite( ta, row, col+n, 1, s, color );\
- }
-
- /* Flags to use to specify method of text array creation
- | (These flags are or'd together and used as the spec flag)
- */
-
- /* Where point is fixed */
- #define PF_BITS 0x0F /* bits defining where point is fixed */
- #define PF_TOP 0x01 /* top */
- #define PF_BOTTOM 0x02 /* bottom */
- #define PF_LEFT 0x04 /* left */
- #define PF_RIGHT 0x08 /* right */
- #define PF_VERT_CNTRD (PF_TOP|PF_BOTTOM) /* top/bottom cntrd */
- #define PF_HORIZ_CNTRD (PF_LEFT|PF_RIGHT) /* left/right cntrd */
- #define PF_LL (PF_BOTTOM|PF_LEFT) /* lower left */
- #define PF_LR (PF_BOTTOM|PF_RIGHT) /* lower right */
- #define PF_UL (PF_TOP|PF_LEFT) /* upper left */
- #define PF_UR (PF_TOP|PF_RIGHT) /* upper right */
- #define PF_CENTERED (PF_VERT_CNTRD|PF_HORIZ_CNTRD) /* centered */
-
- /* How to resolve size when both screen and char coords are specified */
- #define RSLVE_BITS 0x30 /* bits defining how to resolve size */
- #define RSLVE_X_GREATER 0x10 /* take the greater of two in x dir */
- #define RSLVE_Y_GREATER 0x20 /* take the greater of two in y dir */
- #define RSLVE_X_LESSER 0x00 /* take the lesser of two in x dir */
- #define RSLVE_Y_LESSER 0x00 /* take the lesser of two in y dir */
- #define RSLVE_GREATER (RSLVE_X_GREATER|RSLVE_Y_GREATER) /* > of 2 */
- #define RSLVE_LESSER (RSLVE_X_LESSER|RSLVE_Y_LESSER) /* < of 2 */
-
- /* What to do with slop */
- #define SLOP_BITS 0xC0 /* bits defining what to do with slop */
- #define SLOP_LEAVE 0x00 /* leave slop alone */
- #define SLOP_EXPAND 0x40 /* expand to include slop */
- #define SLOP_SHRINK 0x80 /* srink to discard slop */
-
-
- /* Function declarations */
-
- #endif /* _GRTEXTARRAY_H_ */
-